package gameAppLayer.stateMachine.combatState;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import utilities.Key;

import com.jme3.app.Application;
import com.jme3.app.state.AppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.input.InputManager;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Node;

import controls.IMasterControl;

import eventManager.EventManager;
import gameAppLayer.stateMachine.EGameStates;
import gameAppLayer.stateMachine.GameState;
import gameAppLayer.stateMachine.GameStateMachine;
import gameAppLayer.stateMachine.strategyState.StrategyState;

public class CombatState implements AppState {

	private static final Logger logger = Logger.getLogger(CombatState.class.getName());
	
	private Camera cam;
	private InputManager inputManager;
	private String stateID;
	
	/*
	 * Holds MasterControls for either enable or disable states.  These are
	 * subject to update() calls.
	 */
	public ArrayList<IMasterControl> masterControls;
	public HashMap<Key, IMasterControl> masterControlMap;
	
	//Holds all MasterControl objects for enable state
	public ArrayList<IMasterControl> enableControls;
	public HashMap<Key, IMasterControl> enableControlMap;
	
	//Hold all MasterControl objects for !enable state
	public ArrayList<IMasterControl> disableControls;
	public HashMap<Key, IMasterControl> disableControlMap;
	
	private boolean initialized = false;
	private boolean enabled = true;
	
	public CombatState(
			InputManager inputManager, 
			Camera cam) {
		
//		super("CombatState", inputManager);
		this.cam = cam;
		this.inputManager = inputManager;		
		this.stateID = "Combat";
		logger.log(Level.INFO, stateID + " created");
	}
	
	public String getStateID() {
		return this.stateID;
	}
	
	@Override
	public void initialize(AppStateManager stateManager, Application app) {
		initialized = true;
		//continue from here.  Create all objects for enable, !enable states
		
	}	

	@Override
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
		if (enabled) {
			//detach any !enabled state objects
			//attach objects for enabled state
		}
		else {
			//detach any enabled state objects
			//attach object for !enabled state			
		}		
	}
	
	@Override
	public void update(float tpf) {
		if (enabled) {
			//instructions for when game running
		}
		else {
			//instructions for when game paused			
		}
		
	}
	
	@Override
	public void cleanup() {
		initialized = false;
		//Continue with cleaning up...
		//unregister listeners
		//detach nodes
		//etc.		
	}
	
	
	
	
	@Override
	public boolean isInitialized() {
		return initialized;
	}

	@Override
	public boolean isEnabled() {
		return enabled;
	}

	@Override
	public void stateAttached(AppStateManager stateManager) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void stateDetached(AppStateManager stateManager) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void render(RenderManager rm) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postRender() {
		// TODO Auto-generated method stub
		
	}
	
	
	
	
	
	
	
	
	
	
	
	

//	@Override
//	public boolean clear(GameStateMachine stateMachine) {
//		// TODO Auto-generated method stub
//		return false;
//	}
//
//	@Override
//	public boolean initialize(GameStateMachine stateMachine) {
//		// TODO Auto-generated method stub
//		return false;
//	}
//
//	public void onAnalog(String name, float value, float tpf) {
//		// TODO Auto-generated method stub
//		
//	}
//
//	public void onAction(String name, boolean isPressed, float tpf) {
//		// TODO Auto-generated method stub
//		
//	}



	
}
